function verif(champs){
	if (champs.value==""){
	champs.style.backgroundColor="white";
	champs.style.border="1px solid red";
	}
	else{
	champs.style.backgroundColor="green";
	champs.style.border="1px solid green";
	}
}

function init(champs) {
	champs.style.backgroundColor="white";
	champs.style.border="1px solid red";
	champs.value="";
}

function password1(champs){
	if (champs.value.length>5){
		if (champs.value.length>12)
			champs.style.backgroundColor="green";	
		
		else if (champs.value.length>8)
			champs.style.backgroundColor="yellow";	
		
		else{
			champs.style.backgroundColor="orange";
			champs.style.border="green";		
		}
	}
	else{
		champs.style.backgroundColor="white";
		champs.style.border="1px solid red";
	}
}

function password2(champs){
if (champs.value.length<6)
	alert("Mot de passe trop court! (minimum 6 caractères)");
}

function verif_password1(champs){
	if (champs.value==document.formulaire_inscription.password.value)	{	
	champs.style.backgroundColor="green";
	champs.style.border="1px solid green";
	}
	else{
	champs.style.backgroundColor="white";
	champs.style.border="1px solid red";
	}
}

function verif_password2(champs){
	if (champs.value!=document.formulaire_inscription.password.value)
		alert("Mot de passe différents !");
}

function verif_mail1(champs){
	if (champs.value==document.formulaire_inscription.mail.value){	
	champs.style.backgroundColor="green";
	champs.style.border="1px solid green";
	}
	else{
	champs.style.backgroundColor="white";
	champs.style.border="1px solid red";
	}
}

function verif_mail2(champs){
	if (champs.value!=document.formulaire_inscription.mail.value)
		alert("Adresse email différentes !");
	else{
	champs.style.backgroundColor="green";
	champs.style.border="1px solid green";
	}
}

function mail1(champs){

	var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');

	if(reg.test(champs.value)){
		champs.style.backgroundColor="green";
		champs.style.border="1px solid green";
	}
	else{
		champs.style.backgroundColor="white";
		champs.style.border="1px solid red";
	}
}

function mail2(champs){

	var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');

	if(reg.test(champs.value)){
		champs.style.backgroundColor="green";
		champs.style.border="1px solid green";
	}
	else{
		champs.style.backgroundColor="white";
		champs.style.border="1px solid red";
		alert("Adresse email format non valide doit être de la forme X@Y.Z");
	}
}

function tel1(champs){

	var reg = new RegExp('^0[0-9]{9}');
	
	if(reg.test(champs.value)||champs.value==""){
		champs.style.backgroundColor="green";
		champs.style.border="1px solid green";
	}
	else{
		champs.style.backgroundColor="white";
		champs.style.border="1px solid red";
	}
}

function tel2(champs){
	var reg = new RegExp('^0[0-9]{9}');

	if(reg.test(champs.value)||champs.value==""){
		champs.style.backgroundColor="green";
		champs.style.border="1px solid green";
	}
	else{
		champs.style.backgroundColor="white";
		champs.style.border="1px solid red";
		alert("Format du numéro non valide il doit être du format 0XXXXXXXXX");
	}
}

function veriftotal(){

	if (document.formulaire_inscription.password.value<6){
		return false;
		alert("inscription non valide mot de passe trop court !");
		exit;
	}

	if (document.formulaire_inscription.verif_password.value<6 ||document.formulaire_inscription.verif_password.value!=document.formulaire_inscription.password.value ){
		return false;
		alert("inscription non valide mots de passeq différents !");
		exit;
	}
}

function display_c(){
	var refresh=1000; 
	mytime=setTimeout("display_ct()",refresh)
}

function display_ct() {

	var x = new Date();
	var nameday=x.getDay();
	var nhours=x.getHours();
	var nmin=x.getMinutes();
	var nsec=x.getSeconds();
	var nday=x.getDate();
	var nmonth=x.getMonth()+1;
	var nyear=x.getFullYear();
	
	if(nameday==1)
		nameday="lundi";
	else if(nameday==2)
		nameday='mardi';
	else if(nameday==3)
		nameday='mercredi';
	else if(nameday==4)
		nameday='jeudi';
	else if(nameday==5)
		nameday='vendredi';
	else if(nameday==6)
		nameday='samedi';
	else if(nameday==7)
		nameday='dimanche';

	if(nhours<10)
		nhours='0'+nhours;
	if(nmin<10)
		nmin='0'+nmin;
	if(nsec<10)
		nsec='0'+nsec;
	if(nday<10)
		nday='0'+nday;
	if(nmonth<10)
		nmonth='0'+nmonth;

	var date="Nous sommes le "+nameday+" "+nday+'/'+nmonth+'/'+nyear+' '+nhours+':'+nmin+':'+nsec;
	
	document.getElementById("ct").innerHTML = date;
	
	tt=display_c();

}

